#include <iostream>
#include <algorithm>
#include <vector>

int n;
std::vector<int> da;
std::vector<int> a;
std::vector<int> b;

int main()
{
	std::cin >> n;
	da.resize(n); a.resize(n); b.resize(n);
	for (int i = 0; i < n; i++) std::cin >> da[i];
	std::sort(da.begin(), da.end());
	int c1 = 0, c2 = 0;
	for (int i = 0; i < n; i++) {
		a[i] = da[i] / 2;
		b[i] = da[i] - a[i];
		if (i && a[i] == a[i - 1]) {
			c1++;
			if (c1 > c2 + 1) {
			}
		} else if (i && b[i] == b[i - 1]) {
			c2++;
		}
	}
	int r = n / 3 + ((n % 3) > 0);
	if (c1 <= r && c2 <= r) {
		std::cout << "YES\n";
		for (auto i : a) std::cout << i << ' ';
		std::cout << '\n';
		for (auto i : b) std::cout << i << ' ';
		std::cout << '\n';
		return 0;
	}
	std::cout << "NO\n";
}

